<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        //Symbol:是es6新增的数据类型，它是javascript中第七种数据类型
        //Symbol的作用：用来产生一个唯一值

        let goods = Symbol('商品');
        console.log(goods,'goods');
        let s1 = Symbol();
        console.log(s1,'s1');
        let s2 = Symbol();
        console.log(s1 === s2);



        //Symbol用途：防止对象的属性值被覆盖
        let key1 = Symbol();
        let key2 = Symbol();
        let obj = {uname:'李四',age:20,[key1]:'测试'};
        obj.age = 19;
        obj[key2] = '演示'
        console.log(obj);
    </script>
</head>
<body>
    
</body>
</html>